#ifndef __USART_H
#define __USART_H
#include <inttypes.h>

//void USART1_DMAsend(char *msg,uint32_t len); // iba spravy v pevnej pamati !!!
//void USART1_DMAputc(uint8_t ch);
void USART1_IRQHandler(void);
void DMA1_Channel4_IRQHandler(void);
void usart_init(void);

void USART1_DMAsend(char *msg,uint32_t len);
void USART1_DMAputc(uint8_t ch);
//inline int isRX(void);
extern uint8_t usart_rx_xfernum;
#define isRX (usart_rx_xfernum)
uint8_t getChar(void);
void USART1_sendINT(int32_t x,uint8_t len);


// deskriptor DMA prenosu na vysielaciu stranu USARTu
// ak length == 0, prenasa sa jeden znak, obsiahnty v casti char
// ak length != 0, prenasa sa retazec dlzky length, zacinajuci na adrese v !!!pevnej!!! pamati, obsiahnutej v casti address
typedef	struct {
	uint8_t message[64];
	union {
		uint32_t address;
		uint8_t character;
	} payload;
	uint32_t length;
} USART_DMA_DESCRIPTOR;

#endif
